import request from '@/config/axios'

export interface StudentVO {
  id: string
  name: string
  phone: string
  gender: number
  carType: number
  memberId: string
  createTime: number
  updateTime: number
}

export type StudentDTO = Partial<StudentVO>

const baseURL = '/train/student'

// 查询用户列表
export const getStudentPage = async (params) => {
  return await request.get({ url: `${baseURL}/page`, params })
}

// 查询用户详情
export const getStudent = async (id: string) => {
  return await request.get({ url: `${baseURL}/get?id=` + id })
}

// 新增用户
export const createStudent = async (data: StudentVO) => {
  return await request.post({ url: `${baseURL}/create`, data })
}

// 修改用户
export const updateStudent = async (data: StudentVO) => {
  return await request.put({ url: `${baseURL}/update`, data })
}

// 删除用户
export const deleteStudent = async (id: string) => {
  return await request.delete({ url: `${baseURL}/delete?id=` + id })
}

// 导出用户 Excel
export const exportStudent = async (params) => {
  return await request.download({ url: `${baseURL}/export-excel`, params })
}
